﻿Module modGlobal
    Function getUserAppFolder(ByVal argDirLevel1 As String, ByVal argDirLevel2 As String, ByVal argDirLevel3 As String) As String

        Dim myDocs As String = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
        Dim myDir As String = ""

        Dim strDir1 As String = Trim(argDirLevel1)
        If strDir1 = "" Then strDir1 = "TEMP"

        myDir = myDocs & "\" & strDir1
        If Not IO.Directory.Exists(myDir) Then IO.Directory.CreateDirectory(myDir)

        Dim strDir2 As String = Trim(argDirLevel2)
        If strDir2 <> "" Then

            myDir = myDir & "\" & strDir2
            If Not IO.Directory.Exists(myDir) Then IO.Directory.CreateDirectory(myDir)


            Dim strDir3 As String = Trim(argDirLevel3)
            If strDir3 <> "" Then
                myDir = myDir & "\" & strDir3
                If Not IO.Directory.Exists(myDir) Then IO.Directory.CreateDirectory(myDir)
            End If

        End If

        getUserAppFolder = myDir

    End Function
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="textControl"></param>
    ''' <remarks></remarks>
    Sub CheckRedo_undo(ByVal textControl As RichTextBox)
        'If ActiveMdiChild IsNot Nothing Then
        '    Dim ctl As Control
        '    Dim textControl As RichTextBox
        '    For Each ctl In ActiveMdiChild.Controls
        '        If TypeOf ctl Is TextBox Or TypeOf ctl Is RichTextBox Then
        '            If ctl.Focused Then
        '                textControl = ctl
        'If (loai = 1) Then
        If (textControl.CanRedo = True) Then
            mdiMain.RedoToolStripMenuItem.Enabled = True
        Else

            mdiMain.RedoToolStripMenuItem.Enabled = False
        End If
        If (textControl.CanUndo = True) Then
            mdiMain.UndoToolStripMenuItem.Enabled = True
        Else

            mdiMain.UndoToolStripMenuItem.Enabled = False
        End If
        'Else
        '    If (textControl.CanUndo = True) Then
        '        Return True
        '    Else
        '        Return False
        '    End If
        'End If


        '            End If
        '        End If
        '    Next
        'End If
    End Sub
End Module
